package com.galeno.day10;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author galeno
 * @Title:
 * @Description:
 * @date 2021/10/2711:32
 */
public class EventTimeTumbingWindowLeftJoin {
    public static void main(String[] args) {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port",12345);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);
        env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
        DataStreamSource<String> leftlines = env.socketTextStream("192.168.77.3", 9998);
        DataStreamSource<String> rightlines = env.socketTextStream("192.168.77.3", 9999);
        SingleOutputStreamOperator<Tuple3<Long, String, Integer>> tpLeftStream = leftlines.map(new MapFunction<String, Tuple3<Long, String, Integer>>() {
            @Override
            public Tuple3<Long, String, Integer> map(String value) throws Exception {
                String[] split = value.split(",");
                return Tuple3.of(Long.parseLong(split[0]), split[1], Integer.parseInt(split[2]));
            }
        });



    }
}
